package com.wsh.sms.service;

import com.wsh.sms.entity.MonthSalary;
import com.wsh.sms.mapper.MonthSalaryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wsh
 */
@Service
public class MonthSalaryService {

    private final MonthSalaryMapper monthSalaryMapper;

    @Autowired
    public MonthSalaryService(MonthSalaryMapper monthSalaryMapper){
        this.monthSalaryMapper = monthSalaryMapper;
    }

    public List<MonthSalary> getMonthSalaryByNumber(String id){
        return monthSalaryMapper.getMonthSalaryByNumber(id);
    }

    public MonthSalary getOneMonthSalaryByNumber(String number,int year,int month){
        return monthSalaryMapper.getOneMonthSalaryByNumber(number,year,month);
    }

    public int updateEmployeeSalary(String number,int year,int month,double basicSalary,double percentage,double subsidy,String lastYear,String lastMonth){
        return monthSalaryMapper.updateEmployeeSalary(number,year,month,basicSalary,percentage,subsidy,lastYear,lastMonth);
    }

    public int addMonthSalary(String number,int year,int month,double basicSalary,double percentage,double subsidy){
        return monthSalaryMapper.addMonthSalary(number,year,month,basicSalary,percentage,subsidy);
    }

    public int deleteMonthSalary(String number,int year,int month){
        return monthSalaryMapper.deleteMonthSalary(number,year,month);
    }
}
